﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using SharpStockLib.Net;

namespace SharpStockTests
{
    [TestClass]
    public class DownloaderTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        /// <summary>
        ///A test for Download.
        ///Very basic test that tests only the status of the result, not the data
        ///</summary>
        [TestMethod()]
        public void DownloadTest()
        {
            // URL doesn't matter much, only the status is needed.
            Uri resourceToGet = new Uri("http://www.bing.com");
            DownloadResult expected = new DownloadResult();
            expected.Status = DownloadStatus.NoError;

            DownloadResult actual = Downloader.Download(resourceToGet, testContextInstance.TestRunDirectory + "\\out.html");
            Assert.AreEqual(expected.Status, actual.Status);
        }
    }
}
